package com.kaifamiao.charstreams;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class BufferedWriterTest {

    public static void main(String[] args) throws IOException {
        OutputStream out = new FileOutputStream( "bw.txt" );
        Writer writer = new OutputStreamWriter( out, StandardCharsets.UTF_8 );
        BufferedWriter bw = new BufferedWriter( writer );

        bw.write( "今天天气好晴朗" );
        bw.newLine();
        bw.flush();

        bw.write( "好晴朗" );
        bw.newLine();

        bw.close();
        writer.close();
        out.close();
    }

}
